package org.example.controller.bi;

import jakarta.annotation.Resource;
import org.example.domain.Result;
import org.example.domain.bi.DataSpecifications;
import org.example.mapper.DataSpecificationsMapper;
import org.springframework.web.bind.annotation.*;

/**
 * @description:
 * @Author: whopxx
 * @CreateTime: 2025-01-06
 */
@RestController
@RequestMapping("/dataSpecifications")
public class DataSpecificationsController {
    @Resource
    private DataSpecificationsMapper dataSpecificationsMapper;

    @GetMapping("/list")
    public Result list() {
        return Result.success(dataSpecificationsMapper.selectList(null));
    }

    @PostMapping
    public Result add(@RequestBody DataSpecifications dataSpecifications) {
        dataSpecificationsMapper.insert(dataSpecifications);
        return Result.success();
    }


    @PutMapping
    public Result update(@RequestBody DataSpecifications dataSpecifications) {
        dataSpecificationsMapper.updateById(dataSpecifications);
        return Result.success();
    }

    @DeleteMapping
    public Result delete(@RequestParam Integer id) {
        dataSpecificationsMapper.deleteById(id);
        return Result.success();
    }
}
